package algorithm;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class FilterWord {
    public static void main(String[] args) {
        String content = "http://www.jj.cn aaa哈哈 aaa<br/><img id=\"aimg_1883625\" " +
                                 "src=\"https://bbs.cache.jj.cn/fw/c/725a16fb08af241c_212544_864x1152.jpg\" " +
                                 "class=\"imgAttachment\"><br/><img id=\"aimg_1883626\" " +
                                 "src=\"https://bbs.cache.jj.cn/fw/c/ad1f82cd777a6e65_76388_912x1216.jpg\" " +
                                 "class=\"imgAttachment\"><br/><img id=\"aimg_1883627\" " +
                                 "src=\"https://bbs.cache.jj.cn/fw/c/943d012b03fcd581_111400_912x1216.jpg\" " +
                                 "class=\"imgAttachment\"><a href=\"https://www.a.com\">a测a试</a>";
        /*String keyword = "a";
        String replace = "*";
        filter(content,keyword,replace);*/

        String str = "123abc";
        String regx = "^[0-9]+abc$";
        Pattern p_html = Pattern.compile(regx, Pattern.CASE_INSENSITIVE);
        Matcher m_html = p_html.matcher(str);
        System.out.println(m_html.find());
    }
    public static void filter(String content,String keyword,String replace) {
        String regx = "[a]+<.*?>";
        String str = content.replaceAll(regx,replace);
        System.out.println(str);
    }
}
